<div class="main-banner1">
	<div class="swiper-container" data-space-between='10' id="J_ad_slider">
	    <div class="swiper-wrapper" >
	    	<{foreach from=$data.pic item=parent key=parentId}>
	        <div class="swiper-slide"><a href="<{$parent.linktarget}>"><img src="<{$parent.link}>" alt=""></a></div>
	        <{/foreach}>
	    </div>
	</div>
	<div class="slider-point1">
	    <{assign var=countnum value="1"}>
	    <{foreach from=$data.pic item=parent name=name key=parentId}>
	    <span class="trigger-item <{if $smarty.foreach.name.iteration == 1}>act<{/if}>"></span>
	    <{/foreach}>
	</div>
</div>
<div class="under_banner"><img src="<{$setting.banner_under}>"></div>
<script type="text/javascript">
    (function(){
/*图片滚动*/
var adSlider = $('#J_ad_slider');
var inner=adSlider.find('.swiper-wrapper');
var sl = inner.find('.swiper-slide').size();
var sw = inner.find('.swiper-slide').width();
var speed = 200;
var act = 0;
var x1,x2, direct;

function transformBox(obj,value,time){
    var time=time?time:0;
    transl="translate3d("+value+"px,0,0)";
    obj.css({'-webkit-transform':transl,'-webkit-transition':time+'ms linear'});
}

adSlider.on('touchstart', function(e) {
    if(x2) x2 = undefined;
    x1 = e.touches[0].pageX;
})
.on('touchmove', function(e){
    e.preventDefault();
    x2 = e.touches[0].pageX;
    var offset= x2-x1+act*sw;
    transformBox(inner,offset,0);
})
.on('touchend', function(e) {
    if(x1 > x2) direct = 'left';
    else direct = 'right';
    if(Math.abs(x1 - x2) < 30) 
    transformBox(inner,act * sw,100);
})
.swipe(function(e){
    var offset;
    if(direct == 'left') {
        --act;
    }
    else {
        ++act;
    }
    if(act == 1){
        act = 0;
    }
    else if(act == -sl){
        act = - sl + 1;
    }
    offset=act*sw;
    transformBox(inner, offset,speed);
    $(this).next().children().eq(Math.abs(act)).addClass('act').siblings('.act').removeClass('act');
});
/*图片滚动end*/
})();
</script>
